﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dycox.Linq
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = true)]
    public class QueryOperatorAttribute : Attribute
    {
        public QueryOperatorAttribute(string propertyName)
            : this(QueryOperator.Default, propertyName)
        {

        }

        public QueryOperatorAttribute(QueryOperator queryOperator)
            : this(queryOperator, null)
        {

        }

        public QueryOperatorAttribute(QueryOperator queryOperator, string propertyName)
        {
            _operator = queryOperator;
            _targetPropertyName = propertyName;
        }

        private QueryOperator _operator;

        public QueryOperator Operator
        {
            get { return _operator; }
        }

        private string _targetPropertyName;

        public string TargetPropertyName
        {
            get { return _targetPropertyName; }
        }

        
    }

    public enum QueryOperator
    {
        Default = 0,
        Equals = 1,
        NotEquals = 2,
        LessThan = 3,
        LessThanOrEquals = 4,
        GreaterThan = 5,
        GreaterThanOrEquals = 6,
        Between = 10,
        NullTest = 11,
        Contains = 20,
        StartsWith = 21,
        EndsWith = 22,
        Custom = 99,
    }
}
